package com.rankeiot.platform.controller;

import com.rankeiot.core.util.Captcha;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.servlet.mvc.method.annotation.StreamingResponseBody;

import java.util.Map;

@Tag(name="验证码")
@RestController
public class CaptchaController {
    @Operation(summary="图片")
    @GetMapping(value = "captcha",produces = "image/png")
    public ResponseEntity<StreamingResponseBody> captcha(String oldCaptcha){
        return Captcha.captcha(oldCaptcha);
    }
    @Operation(summary="Ajax验证码")
    @GetMapping(value = "captcha_a")
    public Map captcha_a(){
       return Captcha.captchaAjax();
    }
}
